package com.icw.resource.inner.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.icw.basis.BasePoEntity;
import static com.icw.configuration.ConstSettings.*;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
public class IcwFile extends BasePoEntity {

	private static final long serialVersionUID = 1L;

	@Column(length = MEDIUM_LENGTH, nullable = false)
	private String name;

	@Column(nullable = false, updatable = false)
	private Long size;

	@Column(length = MEDIUM_LENGTH, nullable = false, updatable = false)
	private String location;

	@Fetch(FetchMode.JOIN)
	@ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
	@JoinColumn(nullable = false, updatable = false)
	private IcwUser user;
}
